"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _react = _interopRequireDefault(require("react"));

var _components = require("@tarojs/components");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var Item = function Item(_ref) {
  var _item$question, _item$question$beUser, _item$user;

  var item = _ref.data;
  return /*#__PURE__*/_react.default.createElement(_components.View, {
    className: "list-item"
  }, /*#__PURE__*/_react.default.createElement(_components.View, {
    className: "list-item-h"
  }, /*#__PURE__*/_react.default.createElement(_components.View, {
    className: "img"
  }, item.user.avatarUrl && item.user.avatarUrl !== '' ? /*#__PURE__*/_react.default.createElement(_components.Image, {
    src: item.type === 5 && item.question && item.question.is_answer === 1 && item.question.beUser ? item.question.beUser.avatarUrl : item.user.avatarUrl
  }) : /*#__PURE__*/_react.default.createElement(_components.View, {
    className: "default-avatar"
  }, item.user.username[0].toUpperCase())), /*#__PURE__*/_react.default.createElement(_components.View, {
    className: "info"
  }, /*#__PURE__*/_react.default.createElement(_components.Text, {
    className: "name"
  }, item.type === 5 && item.question && item.question.is_answer === 1 && item.question.beUser ? item.question.beUser.username : item.user.username), /*#__PURE__*/_react.default.createElement(_components.View, {
    className: "sub-box"
  }, /*#__PURE__*/_react.default.createElement(_components.Text, {
    className: "date"
  }, "2021-11-11 14:22:22"), item.type === '5' && /*#__PURE__*/_react.default.createElement(_components.View, {
    className: "question-box"
  }, item.question && item.question.is_answer === 0 && /*#__PURE__*/_react.default.createElement(_components.View, {
    className: "question-box-content"
  }, "\u5411", /*#__PURE__*/_react.default.createElement(_components.Text, null, "@", ((_item$question = item.question) === null || _item$question === void 0 ? void 0 : (_item$question$beUser = _item$question.beUser) === null || _item$question$beUser === void 0 ? void 0 : _item$question$beUser.username) || '匿名用户'), "\u63D0\u95EE\uFF1A"), item.question && item.question.is_answer === 1 && /*#__PURE__*/_react.default.createElement(_components.View, {
    className: "question-box-content"
  }, "\u56DE\u7B54\u4E86", /*#__PURE__*/_react.default.createElement(_components.Text, null, "@", ((_item$user = item.user) === null || _item$user === void 0 ? void 0 : _item$user.username) || '匿名用户'), "\u7684\u63D0\u95EE\uFF1A"))))), /*#__PURE__*/_react.default.createElement(_components.View, {
    className: "list-item-content"
  }, item.type === 1 ? /*#__PURE__*/_react.default.createElement(_components.View, {
    className: "title"
  }, "\u53D1\u5E03\u4E86\uFF1A", /*#__PURE__*/_react.default.createElement(_components.Text, null, item.title)) : /*#__PURE__*/_react.default.createElement(_components.View, {
    className: "body"
  }, item.firstPost.summary_component), item.firstPost.images && item.firstPost.images.length > 0 && /*#__PURE__*/_react.default.createElement(_components.View, {
    className: "image-list"
  }, item.firstPost.images.slice(0, 9).map(function (data, key) {
    return /*#__PURE__*/_react.default.createElement(_components.View, {
      className: "image-item image-count-".concat(item.firstPost.images.length >= 3 ? 3 : item.firstPost.images.length),
      style: {
        backgroundImage: "url(".concat(data.thumbUrl, ")")
      },
      key: key
    }, /*#__PURE__*/_react.default.createElement(_components.Image, {
      src: data.thumbUrl
    }));
  })), item.type === 2 && item.threadVideo && /*#__PURE__*/_react.default.createElement(_components.View, {
    className: "video-main"
  }, /*#__PURE__*/_react.default.createElement(_components.Image, {
    className: "play",
    src: "/video.svg"
  }), /*#__PURE__*/_react.default.createElement(_components.View, {
    className: "bgimg",
    style: {
      backgroundImage: "url(".concat(item.threadVideo.cover_url, ")")
    }
  }))), /*#__PURE__*/_react.default.createElement(_components.View, {
    className: "list-item-f"
  }, /*#__PURE__*/_react.default.createElement(_components.View, {
    className: "item"
  }, /*#__PURE__*/_react.default.createElement(_components.Text, {
    className: "qui-icon icon-like"
  }), /*#__PURE__*/_react.default.createElement(_components.Text, null, "\u8D5E", item.firstPost.likeCount || '')), /*#__PURE__*/_react.default.createElement(_components.View, {
    className: "item"
  }, /*#__PURE__*/_react.default.createElement(_components.Text, null, "\u8BC4\u8BBA")), /*#__PURE__*/_react.default.createElement(_components.View, {
    className: "item"
  }, /*#__PURE__*/_react.default.createElement(_components.Text, {
    className: "qui-icon icon-share"
  }), /*#__PURE__*/_react.default.createElement(_components.Text, null, "\u5206\u4EAB"))));
};

var _default = Item;
exports.default = _default;